from libs.players import *
from libs.config import *
from libs.races import *
from libs.effects import *

def getDamage(eventInstance):
    """
    Return the actual damage value. The reason why we have this as a function is
    due to the fact that game mods such as DOD:S and TF2 rely on the event
    variable of name 'damage' whilst CSS relies on 'dmg_health'. We shall see
    which damage varibale exists (if any) and return the actual value.
    
    @param es.EventInfo eventInstance The event instance
    @return int The amount of damage dealt in the event.
    """
    if eventInstance["damage"]:
        return int(eventInstance["damage"])
    if eventInstance["dmg_health"]:
        return int(eventInstance["dmg_health"])
    return 0
    
def getArmorDamage(eventInstance):
    """
    Return the actual damage value. The reason why we have this as a function is
    due to the fact that game mods such as DOD:S and TF2 rely on the event
    variable of name 'armor' whilst CSS relies on 'dmg_armor'. We shall see
    which damage varibale exists (if any) and return the actual value.
    
    @param es.EventInfo eventInstance The event instance
    @return int The amount of armor damage dealt in the event.
    """
    if eventInstance["armor"]:
        return int(eventInstance["armor"])
    if eventInstance["dmg_armor"]:
        return int(eventInstance["dmg_armor"])
    return 0